package com.qgs.wcs.yewu.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qgs.wcs.ioserver.IOServerApi;
import com.qgs.wcs.yewu.entity.MyTest;
import com.qgs.wcs.yewu.mapper.MyTestMapper;
import com.qgs.wcs.yewu.service.IMyTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cxcx
 * @since 2021-09-18
 */
@RestController
@RequestMapping("/yewu/my-test")
public class MyTestController {
    @Autowired
    IMyTestService service;

    @Autowired
    MyTestMapper mapper;

    @GetMapping("/fortest")
    public String fortest() throws Exception{
        MyTest byId = service.getById(22);
        MyTest byId1 = mapper.getById(22);

        //分页 current 是从1 开始的
        IPage<MyTest> byAgePageVo = mapper.getByAgePageVo(new Page<MyTest>(1, 3), 1);
        List<MyTest> records = byAgePageVo.getRecords();
        records.forEach(System.out::println);
        return "1";
    }
}
